using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter19
{
	/// <summary>
	/// Example06: Filling a Scuba Tank
	/// A certain scuba tank is designed to hold 66.0 ft^3 of
	/// air when it is at atmospheric pressure at 22 C. When this
	/// volume of air is compressed to an absolute pressure of
	/// 3000 lb/in^2 and stored in a 10.0 L (0.35 ft^3) tank, the
	/// air becomes so hot that the tank must be allowed to cool
	/// before it can be used. Before the air cools, what is its
	/// temperature? (Assume that the air behaves like an ideal gas.)
	/// T_f = 319 K
	/// </summary>
	public class Example06
	{
		public Example06()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			// 10L = 0.35 ft^3
			L.Temperature t1 = new L.Temperature();
			t1.C = 22.0;
			t1.FindAbsoluteFromCelsius();

			L.Volume v1 = new L.Volume();
			v1.mCUBE = 66.0*10.0E-3/0.35;  

			L.Pressure p1 = new L.Pressure();
			p1.Pa = 101300.0;

			L.Temperature t2 = new L.Temperature();
		
			L.Volume v2 = new L.Volume();
			v2.mCUBE = 10.0E-3;  

			L.Pressure p2 = new L.Pressure();
			p2.Pa = 101300.0*3000.0/14.7;

			t2.K = p2.Pa*v2.mCUBE/p1.Pa/v1.mCUBE*t1.K;
			
			result+=Convert.ToString(t2.K);          
		}
	}
}
